<%- include('layout/header.ejs') %>
<%- include('layout/top.ejs') %>
<%- include('layout/nav.ejs') %>
<%- include('layout/banner.ejs') %>
  <div class="page">
    <div class="p-center">
      <% if (config.source != 'gzh') { %>
      <div class="pc-menu mr-20">
        <div class="pcm-top">培训中心</div>
        <ul class="pcm-ul">
          <% menu.forEach((item, index) => { %>
          <li class="pcmu-li<%= index < menu.length - 1 ? ' mb-10' : '' %>">
            <a class="pcmul-a <%= item.checked ? 'active' : '' %>" href="<%= item.href %>" title="<%= item.title %>"><%= item.title %></a>
          </li>
          <% }) %>
        </ul>
      </div>
      <% } %>
      <div class="pc-content">
        <div class="pcc-search mb-19">
          <span class="pccs-label">教师搜索：</span>
          <input type="text" class="pccs-input" value="<%= keyword %>" placeholder="请输入教师姓名" onkeyup="searchInput(this)" />
          <button type="button" class="pccs-btn" onclick="searchSub()">立即搜索</button>
        </div>
        <ul class="pcc-crumb">
          <li class="pccc-list">
            <p class="pcccl-link">当前位置：</p>
            <a class="pcccl-link" href="<%= config.host %>/" title="首页">首页</a>
            <p class="pcccl-link">&nbsp;»&nbsp;</p>
            <p class="pcccl-link">师资团队</p>
            <p class="pcccl-link">&nbsp;»&nbsp;</p>
            <p class="pcccl-link"><%= crumbName %></p>
          </li>
        </ul>
        <div class="pcc-info p-0">
          <ul class="pcci-teacher">
            <% list.forEach(item => { %>
            <li class="pccit-list">
              <img class="pccitl-avatar" src="<%= item.profilesPic %>" alt="<%= item.name %>" />
              <p class="pccitl-name"><%= item.name %></p>
              <p class="pccitl-desc">性别: <%= item.sex < 1 ? '男教师' : '女教师' %></p>
              <p class="pccitl-desc">教学: <%= item.subject || '' %></p>
            </li>
            <% }) %>
          </ul>
          <div class="my-page">
            <ul class="mp-ul" id="page">
              <%
                let beforePage = parseInt(pageNum) - 1;
                let afterPage = parseInt(pageNum) + 1;
                if (pageNum > 1) {
                  let prevPage = pageNum <= 2 ? '' : `p${beforePage}/`;
              %>
              <li class="mpu-li"><a class="mpul-a" href="<%= config.host %>/<%= pathname %>/<%= prevPage %>">上一页</a></li>
              <%  if (pageNum > 2 && pages > 4) { %>
              <li class="mpu-li"><a class="mpul-a" href="<%= config.host %>/<%= pathname %>/">1</a></li>
              <%  }
                  if (pageNum > 3 && pages > 4) { %>
              <li class="mpu-li"><span class="spot">...</span></li>
              <%  } 
                }
                if (pageNum == pages) {
                  beforePage = parseInt(beforePage) - 2;
                } else if (pageNum == parseInt(pages) - 1) {
                  beforePage = parseInt(beforePage) - 1;
                }
                if (pageNum == 1) {
                  afterPage = parseInt(afterPage) + 2;
                } else if (pageNum == 2) {
                  afterPage = parseInt(afterPage) + 1;
                }
                for (let i = beforePage; i <= afterPage; i ++) {
                  if (i > pages) {
                    continue;
                  }
                  if (i <= 0) {
                    i = i + 1;
                    if (beforePage < 1) {
                      i = 1
                    }
                  }
                  if (i == pageNum) {
              %>
              <li class="mpu-li"><span class="mpul-a active"><%= i %></span></li>
              <%  } else { %>
              <li class="mpu-li"><a class="mpul-a" href="<%= config.host %>/<%= pathname %>/<%= i < 2 ? '' : 'p' + i + '/' %>"><%= i %></a></li>
              <%  }
                }
                if (pageNum < pages) {
                  if (pages > 4) {
                    if (pageNum < pages - 1) {
                      if (pageNum < pages - 2) {
              %>
              <li class="mpu-li"><span class="spot">...</span></li>
              <%      } %>
              <li class="mpu-li"><a class="mpul-a" href="<%= config.host %>/<%= pathname %>/p<%= pages %>/"><%= pages %></a></li>
              <%    }
                  }
                  let nextPage = parseInt(pageNum) + 1;
              %>
              <li class="mpu-li"><a class="mpul-a" href="<%= config.host %>/<%= pathname %>/p<%= nextPage %>/">下一页</a></li>
              <% } %>
            </ul>
          </div>
          <br/>
          <br/>
        </div>
      </div>
    </div>
  </div>
<%- include('layout/bottom.ejs') %>
<%- include('layout/footer.ejs') %>